<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>意见反馈</title>
<script language="javascript" src="<?=public_js_path();?>jquery.js">
</script>
<script language="javascript">
$(document).ready(function() {
	$(".chk").blur( function () {
		eval("chk_"+this.id+"()");
	});
	$("#submit_button").click( function () {
		var title_tag = $("#title_tag").html();
		var content_tag = $("#content_tag").html();
		if( title_tag=="" && content_tag==""){
			var type = $("#type").val();
			var title = $("#title").val();
			var content = $("#content").val();
			suggest(type,title,content);
			return false;
		}else{
			return false;
		}
	});
});
/**
* 验证
*/
function chk_title()
{
    var title = $("#title").val();
	title = $.trim(title);
	if(title==""){
		$("#title_tag").html("标题不能为空！");
		return false;
	}else{
		$("#title_tag").html("");
		return true;
	}
}
function chk_content()
{
    var content = $("#content").val();
	content = $.trim(content);
	if(content==""){
		$("#content_tag").html("内容不能为空！");
		return false;
	}else{
		$("#content_tag").html("");
		return true;
	}
}
function suggest(type,title,content){
	$("#suggest_info").html("<img src='<?=img_path();?>ajaxloading.gif' border=0 />已发送请求,请等待!");
	$.ajax({
		type: "POST",
		url: "<?=site_url(array('home','suggest'));?>",
		data: "type="+type+"&title="+title+"&content="+content,
		success: function(str){
			str = jQuery.parseJSON(str);
			if( str.status==1 ){
				alert(str.info);
				$("#suggest_info").html('');
				return false;
			}else{
				alert(str.info);
				$("#suggest_info").html('');
				return false;
			}
		}
	});
}
</script>
</head>
<body>
    <div>
        <form id="my_form" name="my_form" method="post" action="<?=site_url(array('home','suggest'));?>">
          <ul class="service">
              <li class="posclear">
                  <div class="registw1 posfloatl">类型</div>
                  		<select name='type' id="type">
                        	<option value="suggest">建议</option>
                            <option value="bug">bug</option>
                            <option value="other">其它</option>
                        </select>
              </li>
              <li><div class="registw1 posfloatl">标题</div><input class="chk" type="type" name="title" id="title" />*<span class="red" id="title_tag">请输入标题</span></li>
              <li><div class="registw1 posfloatl">内容</div><textarea class="chk" name="content" id="content" rows="5" cols="50"></textarea>*<span class="red" id="content_tag">请输入内容</span></li>
              <li><input id="submit_button" type="button" value="提交" />&nbsp;&nbsp;&nbsp;<span id="suggest_info" style="color:#FF0000"></span></li>
          </ul>
        </form>
    </div>
</body>
</html>
